package com.gzsxy.factory.method;

import com.gzsxy.factory.Coffee;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 咖啡馆获取不同工厂提供的咖啡并售卖
 * @date 2022/4/10 19:27
 */
public class CoffeeStore {
    private CoffeeFactory factory;
    public void setFactory(CoffeeFactory factory){
        this.factory = factory;
    }

    public Coffee orderCoffee(){
        //获取选中类型咖啡工厂生产的咖啡
        Coffee coffee = factory.createCoffee();
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }
}
